<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<script src="styles/menu/jquery-1.5.2.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="styles/menu/scriptbreaker-multiple-accordion-1.js"></script>
	<script type="text/javascript" src="styles/support/indec.js"></script>
	<script type="text/javascript" src="styles/popup/popup.js"></script>
	<link rel="stylesheet" type="text/css" href="styles/menu/styles.css" />
	<link rel="stylesheet" type="text/css" media="screen" href="styles/grid/css/ui-lightness/jquery-ui-1.8.17.custom.css" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script language="JavaScript">
	
		$(document).ready(function() {
			$(".topnav").accordion({
				accordion:true,
				speed: 500,
				closedSign: '+',
				openedSign: '-'
			});
			resizeFrm();
			jQuery("#valBtn").click( function() {
				$("#pageToRedirect").val('./validationGrid');
				var open = $("#pollOpen").val();
				if(open == 'true')
				{
					centerPopupExit();
					loadPopupExit();
				}
				else
				{
				window.open($("#pageToRedirect").val(),'sommaire');
				}
			});
			jQuery("#obsBtn").click( function() {
				$("#pageToRedirect").val('./rejectCommentsGrid');
				var open = $("#pollOpen").val();
				if(open == 'true')
				{
					centerPopupExit();
					loadPopupExit();
				}
				else
				{
				window.open($("#pageToRedirect").val(),'sommaire');
				}
			});
			jQuery("#pollBtn").click( function() {
				$("#pageToRedirect").val('menuPolls.jsp');
				var open = $("#pollOpen").val();
				if(open == 'true')
				{
					centerPopupExit();
					loadPopupExit();
				}
				else
				{
				window.open($("#pageToRedirect").val(),'_top');
				}
			});
			jQuery("#logOutBtn").click( function() {
				$("#pageToRedirect").val('./destroySession');
				var open = $("#pollOpen").val();
				if(open == 'true')
				{
					centerPopupExit();
					loadPopupExit();
				}
				else
				{
					var agree=confirm("¿Está seguro que desea salir del sistema?");
					if(agree)
					{
						window.open($("#pageToRedirect").val(),'_top');
						return true;
					}
					else
					{
						return false;
					}
				}								
			});
			jQuery("#validateAction").click(function() {
				$("#pageToRedirect").val('./executeAction?action=validate');
				var open = $("#pollOpen").val();
				if(open == 'true')
				{
					centerPopupExit();
					loadPopupExit();
				}
				else
				{
					var agree=confirm("¿Está seguro que desea ejecutar la validación?");
					if(agree)
					{
						window.open($("#pageToRedirect").val(),'sommaire');
						return true;
					}
					else
					{
						return false;
					}
				}				
			});
			jQuery("#sendAction").click(function() {
				$("#pageToRedirect").val('./executeAction?action=send');
				var open = $("#pollOpen").val();
				if(open == 'true')
				{
					centerPopupExit();
					loadPopupExit();
				}
				else
				{
					var agree=confirm("¿Está seguro que desea enviar las encuestas?");
					if(agree)
					{
						window.open($("#pageToRedirect").val(),'sommaire');
						return true;				
					}
					else
					{
						return false;
					}
				}
			});
			jQuery("#rejectAction").click(function() {
				$("#pageToRedirect").val('./executeAction?action=reject');
				var open = $("#pollOpen").val();
				if(open == 'true')
				{
					centerPopupExit();
					loadPopupExit();
				}
				else
				{
					var agree=confirm("¿Está seguro que desea rechazar las encuestas?");
					if(agree)
					{
						window.open($("#pageToRedirect").val(),'sommaire');
						return true;
					}
					else
					{
						return false;
					}
				}				
			});
			jQuery("#approveAction").click(function() {
				$("#pageToRedirect").val('./executeAction?action=approve');
				var open = $("#pollOpen").val();
				if(open == 'true')
				{
					centerPopupExit();
					loadPopupExit();
				}
				else
				{
					var agree=confirm("¿Está seguro que desea aprobar las encuestas?");
					if(agree)
					{
						window.open($("#pageToRedirect").val(),'sommaire');
						return true;
					}
					else
					{
						return false;
					}
				}
			});
			jQuery("#regionalizeAction").click(function() {
				$("#pageToRedirect").val('./executeAction?action=regionalize');
				var open = $("#pollOpen").val();
				if(open == 'true')
				{
					centerPopupExit();
					loadPopupExit();
				}
				else
				{
					var agree=confirm("¿Está seguro que desea Regionalizar?");
					if(agree)
					{
						window.open($("#pageToRedirect").val(),'sommaire');
						return true;
					}
					else
					{
						return false;
					}
				}
			});
		});
		function resizeFrm()
		{
			top.document.getElementById('frm').setAttribute('cols','24%,*');
		}

		function openPoll(parameters)
		{
			var permissionID = document.getElementById("permissionID");
			var permissionIdValue = null;
			if(permissionID != null)
				{
					permissionID = permissionID.value;
				}
			
			$("#pageToRedirect").val('./getPollValues?params=' + parameters);
			var open = $("#pollOpen").val();
			if((open == 'true') && (permissionIdValue != 1))
			{
				centerPopupExit();
				loadPopupExit();
			}
			else
			{
				$("#pollOpen").val('');
				window.open($("#pageToRedirect").val(),'sommaire');
			}
		}
		
	</script>
  <title>

 
  </title>
  
</head>
<body onload="top.sommaire.location.href='menu.html';" style="height: 1000 px;">
<input type="hidden" id="pollOpen" name="pollOpen" value="" />
<input type="hidden" id="pageToRedirect" name="pageToRedirect" value="" />
	<ul class="topnavTitle">
		<li>
			<a href="#" id="companyTitle">
				<c:if test="${companyStatus==1}">
					<img id="companyStatusImg" alt="Status" border="0" src="styles/img/wcircle.png" width="12" height="12">
				</c:if>
				<c:if test="${companyStatus==2}">
					<img id="companyStatusImg" alt="Status" border="0" src="styles/img/gcircle.png" width="12" height="12">
				</c:if>
				<c:if test="${companyStatus==3}">
					<img id="companyStatusImg" alt="Status" border="0" src="styles/img/pending.png" width="12" height="12">
				</c:if>
				<c:if test="${companyStatus==4}">
					<img id="companyStatusImg" alt="Status" border="0" src="styles/img/review.png" width="12" height="12">
				</c:if>
				<c:if test="${companyStatus==5}">
					<img id="companyStatusImg" alt="Status" border="0" src="styles/img/reject.png" width="12" height="12">
				</c:if>
				<c:if test="${companyStatus==6}">
					<img id="companyStatusImg" alt="Status" border="0" src="styles/img/accept.png" width="12" height="12">
				</c:if>
				<c:out value="${companyName}"/>
				<br/>
				<span id="titleDescription" style="font-size: 10px; position: relative; top: 5px">
					<c:out value="${companyTitle}"/>
				</span>
			 </a>
		</li>
	</ul>
	<ul class="topnav">
		<li><a href="#"><fmt:message key='menu.company'/></a>
			<ul>
				<c:forEach items="${requestScope.companyPollsList}" var="companyPoll">
					<c:if test="${(companyPoll.status==1)}">
						<li><a id="<c:out value="${companyPoll.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${companyPoll.params}"/>');"><img id="img<c:out value="${companyPoll.params}"/>" alt="Status" border="0" src="styles/img/wcircle.png" width="8" height="8"> <c:out value="${companyPoll.name}"/></a></li>
					</c:if>
					<c:if test="${(companyPoll.status==2)}">
						<li><a id="<c:out value="${companyPoll.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${companyPoll.params}"/>');"><img id="img<c:out value="${companyPoll.params}"/>" alt="Status" border="0" src="styles/img/gcircle.png" width="8" height="8"> <c:out value="${companyPoll.name}"/></a></li>
					</c:if>
					<c:if test="${(companyPoll.status==3)}">
						<li><a id="<c:out value="${companyPoll.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${companyPoll.params}"/>');"><img id="img<c:out value="${companyPoll.params}"/>" alt="Status" border="0" src="styles/img/rcircle.png" width="8" height="8"> <c:out value="${companyPoll.name}"/></a></li>
					</c:if>
					<c:if test="${(companyPoll.status==4)}">
						<li><a id="<c:out value="${companyPoll.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${companyPoll.params}"/>');"><img id="img<c:out value="${companyPoll.params}"/>" alt="Status" border="0" src="styles/img/validate_ok.gif" width="8" height="8"> <c:out value="${companyPoll.name}"/></a></li>
					</c:if>
					<c:if test="${(companyPoll.status==5)}">
						<li><a id="<c:out value="${companyPoll.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${companyPoll.params}"/>');"><img id="img<c:out value="${companyPoll.params}"/>" alt="Status" border="0" src="styles/img/validate_error.gif" width="8" height="8"> <c:out value="${companyPoll.name}"/></a></li>
					</c:if>
					<c:if test="${(companyPoll.status==6)}">
						<li><a id="<c:out value="${companyPoll.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${companyPoll.params}"/>');"><img id="img<c:out value="${companyPoll.params}"/>" alt="Status" border="0" src="styles/img/pending.png" width="8" height="8"> <c:out value="${companyPoll.name}"/></a></li>
					</c:if>
					<c:if test="${(companyPoll.status==7)}">
						<li><a id="<c:out value="${companyPoll.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${companyPoll.params}"/>');"><img id="img<c:out value="${companyPoll.params}"/>" alt="Status" border="0" src="styles/img/accept.png" width="8" height="8"> <c:out value="${companyPoll.name}"/></a></li>
					</c:if>
					<c:if test="${(companyPoll.status==8)}">
						<li><a id="<c:out value="${companyPoll.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${companyPoll.params}"/>');"><img id="img<c:out value="${companyPoll.params}"/>" alt="Status" border="0" src="styles/img/reject.png" width="8" height="8"> <c:out value="${companyPoll.name}"/></a></li>
					</c:if>
				</c:forEach>
			</ul>
		</li>
		<li><a href="#"><fmt:message key='menu.locals'/></a>
			<ul>
				<c:forEach items="${requestScope.localsList}" var="locals">
					<li><a href="#"><c:out value="${locals.name}"/></a>
						<ul>
							<c:forEach items="${requestScope.annexesList}" var="annexes">
								<c:if test="${(locals.local==annexes.local) && (annexes.status==1)}">
									<li><a id="<c:out value="${annexes.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${annexes.params}"/>');"><img id="img<c:out value="${annexes.params}"/>" alt="Status" border="0" src="styles/img/wcircle.png" width="8" height="8"> <c:out value="${annexes.name}"/></a></li>
								</c:if>
								<c:if test="${(locals.local==annexes.local) && (annexes.status==2)}">
									<li><a id="<c:out value="${annexes.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${annexes.params}"/>');"><img id="img<c:out value="${annexes.params}"/>" alt="Status" border="0" src="styles/img/gcircle.png" width="8" height="8"> <c:out value="${annexes.name}"/></a></li>
								</c:if>
								<c:if test="${(locals.local==annexes.local) && (annexes.status==3)}">
									<li><a id="<c:out value="${annexes.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${annexes.params}"/>');"><img id="img<c:out value="${annexes.params}"/>" alt="Status" border="0" src="styles/img/rcircle.png" width="8" height="8"> <c:out value="${annexes.name}"/></a></li>
								</c:if>
								<c:if test="${(locals.local==annexes.local) && (annexes.status==4)}">
									<li><a id="<c:out value="${annexes.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${annexes.params}"/>');"><img id="img<c:out value="${annexes.params}"/>" alt="Status" border="0" src="styles/img/validate_ok.gif" width="8" height="8"> <c:out value="${annexes.name}"/></a></li>
								</c:if>
								<c:if test="${(locals.local==annexes.local) && (annexes.status==5)}">
									<li><a id="<c:out value="${annexes.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${annexes.params}"/>');"><img id="img<c:out value="${annexes.params}"/>" alt="Status" border="0" src="styles/img/validate_error.gif" width="8" height="8"> <c:out value="${annexes.name}"/></a></li>
								</c:if>
								<c:if test="${(locals.local==annexes.local) && (annexes.status==6)}">
									<li><a id="<c:out value="${annexes.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${annexes.params}"/>');"><img id="img<c:out value="${annexes.params}"/>" alt="Status" border="0" src="styles/img/pending.png" width="8" height="8"> <c:out value="${annexes.name}"/></a></li>
								</c:if>
								<c:if test="${(locals.local==annexes.local) && (annexes.status==7)}">
									<li><a id="<c:out value="${annexes.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${annexes.params}"/>');"><img id="img<c:out value="${annexes.params}"/>" alt="Status" border="0" src="styles/img/accept.png" width="8" height="8"> <c:out value="${annexes.name}"/></a></li>
								</c:if>
								<c:if test="${(locals.local==annexes.local) && (annexes.status==8)}">
									<li><a id="<c:out value="${annexes.params}"/>" target="sommaire" href="javascript:void(0);" onclick="openPoll('<c:out value="${annexes.params}"/>');"><img id="img<c:out value="${annexes.params}"/>" alt="Status" border="0" src="styles/img/reject.png" width="8" height="8"> <c:out value="${annexes.name}"/></a></li>
								</c:if>
							</c:forEach>
						</ul>
					</li>
				</c:forEach>
			</ul>
		</li>
		<c:if test="${attHasActions=='true'}">
			<li><a href="#">Acciones</a>
				<ul>
					<c:if test="${attBtnEncValidate=='true'}">
						<li><a class="confirm" target="sommaire" id="validateAction" href="javascript:return false;"><img id="validateStatusImg" alt="Status" border="0" src="styles/img/validate.png" width="10" height="10"> Validar Encuestas</a></li>
					</c:if>
					<c:if test="${attBtnEncSend=='true'}">
						<li><a class="confirm" target="sommaire" id="sendAction" href="javascript:return false;"><img id="sendStatusImg" alt="Status" border="0" src="styles/img/send.png" width="10" height="10"> Enviar Encuestas</a></li>
					</c:if>
					<c:if test="${attBtnEncReject=='true'}">
						<li><a class="confirm" target="sommaire" id="rejectAction" href="javascript:return false;"><img id="rejectStatusImg" alt="Status" border="0" src="styles/img/reject.png" width="10" height="10"> Rechazar Encuestas</a></li>					
					</c:if>
					<c:if test="${attBtnEncApprove=='true'}">
						<li><a class="confirm" target="sommaire" id="approveAction" href="javascript:return false;"><img id="approveStatusImg" alt="Status" border="0" src="styles/img/accept.png" width="10" height="10"> Aprobar Encuestas</a></li>
					</c:if>
					<c:if test="${attBtnEncRegionalize=='true'}">
						<li><a class="confirm" target="sommaire" id="regionalizeAction" href="javascript:return false;"><img id="regionalizeStatusImg" alt="Status" border="0" src="styles/img/regionalize.png" width="10" height="10"> Regionalizar</a></li>
					</c:if>
				</ul>
			</li>
		</c:if>
	</ul>
	<br/>
	<input type="button" id="valBtn" value="Validaciones" class="fg-button ui-state-default ui-corner-all" style="width: 150px"/>
	<br/>
	<br/>
	<input type="button" id="obsBtn" value="Observaciones" class="fg-button ui-state-default ui-corner-all" style="width: 150px"/>
	<br/>
	<br/>
	<input type="button" id="pollBtn" value="Encuestas" class="fg-button ui-state-default ui-corner-all" style="width: 150px"/>
	<br/>
<!--	<br/>-->
<!--	<input type="button" id="downloadBtn" value="Descargar Encuestas" class="fg-button ui-state-default ui-corner-all" style="width: 150px;"/>-->
<!--	<br/>-->
	<br/>
	<input type="button" id="logOutBtn" value="<fmt:message key='session.close'/>" class="fg-button ui-state-default ui-corner-all" style="width: 150px"/>
</body>
</html>